//
//  HWCustomerServiceCenterViewController.m
//  HWanGame
//
//  Created by 陈道斌 on 2019/10/16.
//  Copyright © 2019 Chendaobin. All rights reserved.
//

#import "HWCustomerServiceCenterViewController.h"
#import "HWKeFuModel.h"
#import "HWKeFuTableViewCell.h"
#import "HWArtificialKeFuViewController.h"
#import "HWFeedBackViewController.h"


@interface HWCustomerServiceCenterViewController ()<UITableViewDataSource,UITableViewDelegate>
@property(strong,nonatomic) UITableView *mainaTableVie;
@property(strong,nonatomic) UIView *lowerPartView;
@property(strong,nonatomic) NSMutableArray *dataMuArr;
@end

@implementation HWCustomerServiceCenterViewController


-(UITableView *)mainaTableVie {
    
    if (_mainaTableVie == nil
        ) {
    
        _mainaTableVie = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, kScreenW, kScreenH-50-TabbarSafeBottomMargin) style:UITableViewStylePlain];
        _mainaTableVie.delegate = self;
        _mainaTableVie.dataSource = self;
        _mainaTableVie.separatorStyle = UITableViewCellSeparatorStyleNone;
        _mainaTableVie.backgroundColor = [UIColor whiteColor];
        _mainaTableVie.backgroundColor = RGB(228, 235, 247);
        
        
        
        
        
        
        
    }
    return   _mainaTableVie ;
}



- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    [self setCommonProperties];
    
    [self setupUI];
    
}

// 设置常用的属性
- (void)setCommonProperties {
    self.dataMuArr = [[NSMutableArray alloc]init];
    
    
    HWKeFuModel *model1 = [[HWKeFuModel alloc]init];
    model1.icoStr = @"cus_charge";
    model1.nameStr = @"充值返利";
    model1.xianshiStr = @"1";
    model1.str1 = @"充值未到账";
    model1.str2 = @"充值限额";
    model1.str3 = @"充值打折";
    model1.str4 = @"提现到账时间";
    
    
    HWKeFuModel *model2 = [[HWKeFuModel alloc]init];
    model2.icoStr = @"cus_safe";
    model2.nameStr = @"账号安全";
    model2.xianshiStr = @"2";
    model2.str1 = @"账号被盗、交易专栏";
    model2.str2 = @"忘记账号";
    model2.str3 = @"忘记密码";
    model2.str4 = @"如何换换绑手机号";
    
    HWKeFuModel *model3 = [[HWKeFuModel alloc]init];
    model3.icoStr = @"cus_deal";
    model3.nameStr = @"商品交易";
    model3.xianshiStr = @"2";
    model3.str1 = @"交易审核时间";
    model3.str2 = @"交易是否支持提现";
    model3.str3 = @"交易是否影响账号安全";
    model3.str4 = @"交易描述商品有误怎么办";
    
    
    HWKeFuModel *model4 = [[HWKeFuModel alloc]init];
    model4.icoStr = @"cus_order";
    model4.nameStr = @"其他问题";
    model4.xianshiStr = @"2";
    model4.str1 = @"IOS设置信任";
    model4.str2 = @"下载登录异常";
    model4.str3 = @"游戏内觉得被封号";
    model4.str4 = @"游戏下载无法安装";
    
    
    [self.dataMuArr addObject:model1];
      [self.dataMuArr addObject:model2];
  [self.dataMuArr addObject:model3];
  [self.dataMuArr addObject:model4];
    
    
    
    
}




- (void)setupUI {
    
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"客服中心";
    [self.view addSubview:self.mainaTableVie];
    
    [self addLowerPartView];
    
    
    
    
}





// 添加低部UIview
- (void)addLowerPartView {
    
    self.lowerPartView = [[UIView alloc]initWithFrame:CGRectMake(0, kScreenH-50-CF_TabbarSafeBottomMargin, kScreenW, 50+CF_TabbarSafeBottomMargin)];
    // self.lowerPartView.backgroundColor = [UIColor yellowColor];
    self.lowerPartView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.lowerPartView];
    
    UIButton *butt  = [UIButton setButtonWithFrame:CGRectMake(36*CFLScaleValue, 7, 120*CFLScaleValue, 35) Title:@"意见反馈" Image:nil Font:14 Color:RGB(255, 255, 255) Target:self Selector:@selector(ytijianTap:)];
    butt.backgroundColor = blueBackgroundBT;
    butt.layer.cornerRadius = 17;
    butt.layer.masksToBounds = YES;
    [self.lowerPartView addSubview:butt];
    
    
    UIButton *butt1  = [UIButton setButtonWithFrame:CGRectMake(36*CFLScaleValue+120*CFLScaleValue+63*CFLScaleValue, 7, 120*CFLScaleValue, 35) Title:@"人工客服" Image:nil Font:14 Color:RGB(255, 255, 255) Target:self Selector:@selector(rebgongTap)];
     butt1.backgroundColor = blueBackgroundBT;
     butt1.layer.cornerRadius = 17;
     butt1.layer.masksToBounds = YES;
     [self.lowerPartView addSubview:butt1];
    
    
    
    
//    UIButton *butt1  = [UIButton setButtonWithFrame:CGRectMake(7, 0, 50, 44) Title:@"收藏" Image:@"details_sellect_a" Font:10 Color:RGB(178, 178, 178) Target:self Selector:@selector(shoucangTap:)];
//    [butt1 setImage:[UIImage imageNamed:@"details_sellect_b"] forState:UIControlStateSelected];
//
//   // butt1.backgroundColor = RGB(38, 154, 255);
//    [butt1 layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleTop imageTitleSpace:5];
//    [self.lowerPartView addSubview:butt1];
//
//    UIButton *butt2  = [UIButton setButtonWithFrame:CGRectMake(kScreenW-65+7, 0, 50, 44) Title:@"分享" Image:@"details_share_a" Font:10 Color:RGB(178, 178, 178) Target:self Selector:@selector(fenxiangTap:)];
//
//
//    // butt1.backgroundColor = RGB(38, 154, 255);
//    [butt2 layoutButtonWithEdgeInsetsStyle:MKButtonEdgeInsetsStyleTop imageTitleSpace:5];
//    [self.lowerPartView addSubview:butt2];
    
    
}


// 意见反馈
- (void)ytijianTap:(UIButton *)sender {
    
    HWFeedBackViewController *feedBack = [[HWFeedBackViewController alloc]init];
    [self.navigationController pushViewController:feedBack animated:YES];
    
    
    
}

// 人工客服
- (void)rebgongTap {
    
    HWArtificialKeFuViewController *artificialKeFu = [[HWArtificialKeFuViewController alloc]init];
    [self.navigationController pushViewController:artificialKeFu animated:YES];
    
}









#pragma mark -------- UITableViewDelegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return  self.dataMuArr.count;
    
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellID = @"cellID";
    
    
    HWKeFuTableViewCell  *cell  = [tableView dequeueReusableCellWithIdentifier:cellID];
    
    if (!cell) {
        cell =  [[NSBundle mainBundle]loadNibNamed:@"HWKeFuTableViewCell" owner:nil options:nil].lastObject;
        
        
    }

    HWKeFuModel *model = self.dataMuArr[indexPath.row];
    cell.model = model;
    cell.backgroundColor =  RGB(228, 235, 247);
    cell.selectionStyle  = UITableViewCellSelectionStyleNone;
    
    return  cell;
    

    
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    
    return  131;
    
}


@end
